import { _decorator, Vec3 } from "cc";
const { ccclass } = _decorator;

// 射击策略接口
export interface IShootStrategy {
  shoot(position: Vec3, direction: Vec3): void;
}

// 单发射击策略
@ccclass("SingleShot")
export class SingleShot implements IShootStrategy {
  shoot(position: Vec3, direction: Vec3): void {
    // 创建单个子弹
    console.log("Single shot fired from", position, "in direction", direction);
    // TODO: 实现具体的子弹生成和发射逻辑
  }
}

// 散射策略
@ccclass("SpreadShot")
export class SpreadShot implements IShootStrategy {
  private _bulletCount: number = 3;
  private _spreadAngle: number = 15;

  shoot(position: Vec3, direction: Vec3): void {
    // 创建多个子弹，呈扇形分布
    console.log(
      "Spread shot fired from",
      position,
      "with",
      this._bulletCount,
      "bullets"
    );
    // TODO: 实现扇形分布的多子弹生成和发射逻辑
  }
}

// 激光射击策略
@ccclass("LaserShot")
export class LaserShot implements IShootStrategy {
  shoot(position: Vec3, direction: Vec3): void {
    // 创建持续的激光束
    console.log("Laser beam fired from", position, "in direction", direction);
    // TODO: 实现激光束的生成和持续发射逻辑
  }
}
